\(\int \cot ^3(e+f x) (a+b \tan ^2(e+f x))^p \, dx\) [365]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [F]
   Fricas [F]
   Sympy [F(-1)]
   Maxima [F]
   Giac [F]
   Mupad [F(-1)]

Optimal result

Integrand size = 23, antiderivative size = 158 \[ \int \cot ^3(e+f x) \left (a+b \tan ^2(e+f x)\right )^p \, dx=-\frac {\cot ^2(e+f x) \left (a+b \tan ^2(e+f x)\right )^{1+p}}{2 a f}-\frac {\operatorname {Hypergeometric2F1}\left (1,1+p,2+p,\frac {a+b \tan ^2(e+f x)}{a-b}\right ) \left (a+b \tan ^2(e+f x)\right )^{1+p}}{2 (a-b) f (1+p)}+\frac {(a-b p) \operatorname {Hypergeometric2F1}\left (1,1+p,2+p,1+\frac {b \tan ^2(e+f x)}{a}\right ) \left (a+b \tan ^2(e+f x)\right )^{1+p}}{2 a^2 f (1+p)} \]

[Out]

-1/2*cot(f*x+e)^2*(a+b*tan(f*x+e)^2)^(p+1)/a/f-1/2*hypergeom([1, p+1],[2+p],(a+b*tan(f*x+e)^2)/(a-b))*(a+b*tan
(f*x+e)^2)^(p+1)/(a-b)/f/(p+1)+1/2*(-b*p+a)*hypergeom([1, p+1],[2+p],1+b*tan(f*x+e)^2/a)*(a+b*tan(f*x+e)^2)^(p
+1)/a^2/f/(p+1)

Rubi [A] (verified)

Time = 0.19 (sec) , antiderivative size = 158, normalized size of antiderivative = 1.00, number of steps used = 6, number of rules used = 6, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.261, Rules used = {3751, 457, 105, 162, 67, 70} \[ \int \cot ^3(e+f x) \left (a+b \tan ^2(e+f x)\right )^p \, dx=\frac {(a-b p) \left (a+b \tan ^2(e+f x)\right )^{p+1} \operatorname {Hypergeometric2F1}\left (1,p+1,p+2,\frac {b \tan ^2(e+f x)}{a}+1\right )}{2 a^2 f (p+1)}-\frac {\left (a+b \tan ^2(e+f x)\right )^{p+1} \operatorname {Hypergeometric2F1}\left (1,p+1,p+2,\frac {b \tan ^2(e+f x)+a}{a-b}\right )}{2 f (p+1) (a-b)}-\frac {\cot ^2(e+f x) \left (a+b \tan ^2(e+f x)\right )^{p+1}}{2 a f} \]

[In]

Int[Cot[e + f*x]^3*(a + b*Tan[e + f*x]^2)^p,x]

[Out]

-1/2*(Cot[e + f*x]^2*(a + b*Tan[e + f*x]^2)^(1 + p))/(a*f) - (Hypergeometric2F1[1, 1 + p, 2 + p, (a + b*Tan[e
+ f*x]^2)/(a - b)]*(a + b*Tan[e + f*x]^2)^(1 + p))/(2*(a - b)*f*(1 + p)) + ((a - b*p)*Hypergeometric2F1[1, 1 +
 p, 2 + p, 1 + (b*Tan[e + f*x]^2)/a]*(a + b*Tan[e + f*x]^2)^(1 + p))/(2*a^2*f*(1 + p))

Rule 67

Int[((b_.)*(x_))^(m_)*((c_) + (d_.)*(x_))^(n_), x_Symbol] :> Simp[((c + d*x)^(n + 1)/(d*(n + 1)*(-d/(b*c))^m))
*Hypergeometric2F1[-m, n + 1, n + 2, 1 + d*(x/c)], x] /; FreeQ[{b, c, d, m, n}, x] &&  !IntegerQ[n] && (Intege
rQ[m] || GtQ[-d/(b*c), 0])

Rule 70

Int[((a_) + (b_.)*(x_))^(m_)*((c_) + (d_.)*(x_))^(n_), x_Symbol] :> Simp[(b*c - a*d)^n*((a + b*x)^(m + 1)/(b^(
n + 1)*(m + 1)))*Hypergeometric2F1[-n, m + 1, m + 2, (-d)*((a + b*x)/(b*c - a*d))], x] /; FreeQ[{a, b, c, d, m
}, x] && NeQ[b*c - a*d, 0] &&  !IntegerQ[m] && IntegerQ[n]

Rule 105

Int[((a_.) + (b_.)*(x_))^(m_)*((c_.) + (d_.)*(x_))^(n_.)*((e_.) + (f_.)*(x_))^(p_.), x_Symbol] :> Simp[b*(a +
b*x)^(m + 1)*(c + d*x)^(n + 1)*((e + f*x)^(p + 1)/((m + 1)*(b*c - a*d)*(b*e - a*f))), x] + Dist[1/((m + 1)*(b*
c - a*d)*(b*e - a*f)), Int[(a + b*x)^(m + 1)*(c + d*x)^n*(e + f*x)^p*Simp[a*d*f*(m + 1) - b*(d*e*(m + n + 2) +
 c*f*(m + p + 2)) - b*d*f*(m + n + p + 3)*x, x], x], x] /; FreeQ[{a, b, c, d, e, f, n, p}, x] && ILtQ[m, -1] &
& (IntegerQ[n] || IntegersQ[2*n, 2*p] || ILtQ[m + n + p + 3, 0])

Rule 162

Int[(((e_.) + (f_.)*(x_))^(p_)*((g_.) + (h_.)*(x_)))/(((a_.) + (b_.)*(x_))*((c_.) + (d_.)*(x_))), x_Symbol] :>
 Dist[(b*g - a*h)/(b*c - a*d), Int[(e + f*x)^p/(a + b*x), x], x] - Dist[(d*g - c*h)/(b*c - a*d), Int[(e + f*x)
^p/(c + d*x), x], x] /; FreeQ[{a, b, c, d, e, f, g, h}, x]

Rule 457

Int[(x_)^(m_.)*((a_) + (b_.)*(x_)^(n_))^(p_.)*((c_) + (d_.)*(x_)^(n_))^(q_.), x_Symbol] :> Dist[1/n, Subst[Int
[x^(Simplify[(m + 1)/n] - 1)*(a + b*x)^p*(c + d*x)^q, x], x, x^n], x] /; FreeQ[{a, b, c, d, m, n, p, q}, x] &&
 NeQ[b*c - a*d, 0] && IntegerQ[Simplify[(m + 1)/n]]

Rule 3751

Int[((d_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((a_) + (b_.)*((c_.)*tan[(e_.) + (f_.)*(x_)])^(n_))^(p_.), x_Symbol]
 :> With[{ff = FreeFactors[Tan[e + f*x], x]}, Dist[c*(ff/f), Subst[Int[(d*ff*(x/c))^m*((a + b*(ff*x)^n)^p/(c^2
 + ff^2*x^2)), x], x, c*(Tan[e + f*x]/ff)], x]] /; FreeQ[{a, b, c, d, e, f, m, n, p}, x] && (IGtQ[p, 0] || EqQ
[n, 2] || EqQ[n, 4] || (IntegerQ[p] && RationalQ[n]))

Rubi steps \begin{align*} \text {integral}& = \frac {\text {Subst}\left (\int \frac {\left (a+b x^2\right )^p}{x^3 \left (1+x^2\right )} \, dx,x,\tan (e+f x)\right )}{f} \\ & = \frac {\text {Subst}\left (\int \frac {(a+b x)^p}{x^2 (1+x)} \, dx,x,\tan ^2(e+f x)\right )}{2 f} \\ & = -\frac {\cot ^2(e+f x) \left (a+b \tan ^2(e+f x)\right )^{1+p}}{2 a f}-\frac {\text {Subst}\left (\int \frac {(a+b x)^p (a-b p-b p x)}{x (1+x)} \, dx,x,\tan ^2(e+f x)\right )}{2 a f} \\ & = -\frac {\cot ^2(e+f x) \left (a+b \tan ^2(e+f x)\right )^{1+p}}{2 a f}+\frac {\text {Subst}\left (\int \frac {(a+b x)^p}{1+x} \, dx,x,\tan ^2(e+f x)\right )}{2 f}-\frac {(a-b p) \text {Subst}\left (\int \frac {(a+b x)^p}{x} \, dx,x,\tan ^2(e+f x)\right )}{2 a f} \\ & = -\frac {\cot ^2(e+f x) \left (a+b \tan ^2(e+f x)\right )^{1+p}}{2 a f}-\frac {\operatorname {Hypergeometric2F1}\left (1,1+p,2+p,\frac {a+b \tan ^2(e+f x)}{a-b}\right ) \left (a+b \tan ^2(e+f x)\right )^{1+p}}{2 (a-b) f (1+p)}+\frac {(a-b p) \operatorname {Hypergeometric2F1}\left (1,1+p,2+p,1+\frac {b \tan ^2(e+f x)}{a}\right ) \left (a+b \tan ^2(e+f x)\right )^{1+p}}{2 a^2 f (1+p)} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.73 (sec) , antiderivative size = 142, normalized size of antiderivative = 0.90 \[ \int \cot ^3(e+f x) \left (a+b \tan ^2(e+f x)\right )^p \, dx=\frac {\left (b+a \cot ^2(e+f x)\right ) \left (-a^2 \operatorname {Hypergeometric2F1}\left (1,1+p,2+p,\frac {a+b \tan ^2(e+f x)}{a-b}\right )-(a-b) \left (a (1+p) \cot ^2(e+f x)+(-a+b p) \operatorname {Hypergeometric2F1}\left (1,1+p,2+p,1+\frac {b \tan ^2(e+f x)}{a}\right )\right )\right ) \tan ^2(e+f x) \left (a+b \tan ^2(e+f x)\right )^p}{2 a^2 (a-b) f (1+p)} \]

[In]

Integrate[Cot[e + f*x]^3*(a + b*Tan[e + f*x]^2)^p,x]

[Out]

((b + a*Cot[e + f*x]^2)*(-(a^2*Hypergeometric2F1[1, 1 + p, 2 + p, (a + b*Tan[e + f*x]^2)/(a - b)]) - (a - b)*(
a*(1 + p)*Cot[e + f*x]^2 + (-a + b*p)*Hypergeometric2F1[1, 1 + p, 2 + p, 1 + (b*Tan[e + f*x]^2)/a]))*Tan[e + f
*x]^2*(a + b*Tan[e + f*x]^2)^p)/(2*a^2*(a - b)*f*(1 + p))

Maple [F]

\[\int \cot \left (f x +e \right )^{3} \left (a +b \tan \left (f x +e \right )^{2}\right )^{p}d x\]

[In]

int(cot(f*x+e)^3*(a+b*tan(f*x+e)^2)^p,x)

[Out]

int(cot(f*x+e)^3*(a+b*tan(f*x+e)^2)^p,x)

Fricas [F]

\[ \int \cot ^3(e+f x) \left (a+b \tan ^2(e+f x)\right )^p \, dx=\int { {\left (b \tan \left (f x + e\right )^{2} + a\right )}^{p} \cot \left (f x + e\right )^{3} \,d x } \]

[In]

integrate(cot(f*x+e)^3*(a+b*tan(f*x+e)^2)^p,x, algorithm="fricas")

[Out]

integral((b*tan(f*x + e)^2 + a)^p*cot(f*x + e)^3, x)

Sympy [F(-1)]

Timed out. \[ \int \cot ^3(e+f x) \left (a+b \tan ^2(e+f x)\right )^p \, dx=\text {Timed out} \]

[In]

integrate(cot(f*x+e)**3*(a+b*tan(f*x+e)**2)**p,x)

[Out]

Timed out

Maxima [F]

\[ \int \cot ^3(e+f x) \left (a+b \tan ^2(e+f x)\right )^p \, dx=\int { {\left (b \tan \left (f x + e\right )^{2} + a\right )}^{p} \cot \left (f x + e\right )^{3} \,d x } \]

[In]

integrate(cot(f*x+e)^3*(a+b*tan(f*x+e)^2)^p,x, algorithm="maxima")

[Out]

integrate((b*tan(f*x + e)^2 + a)^p*cot(f*x + e)^3, x)

Giac [F]

\[ \int \cot ^3(e+f x) \left (a+b \tan ^2(e+f x)\right )^p \, dx=\int { {\left (b \tan \left (f x + e\right )^{2} + a\right )}^{p} \cot \left (f x + e\right )^{3} \,d x } \]

[In]

integrate(cot(f*x+e)^3*(a+b*tan(f*x+e)^2)^p,x, algorithm="giac")

[Out]

integrate((b*tan(f*x + e)^2 + a)^p*cot(f*x + e)^3, x)

Mupad [F(-1)]

Timed out. \[ \int \cot ^3(e+f x) \left (a+b \tan ^2(e+f x)\right )^p \, dx=\int {\mathrm {cot}\left (e+f\,x\right )}^3\,{\left (b\,{\mathrm {tan}\left (e+f\,x\right )}^2+a\right )}^p \,d x \]

[In]

int(cot(e + f*x)^3*(a + b*tan(e + f*x)^2)^p,x)

[Out]

int(cot(e + f*x)^3*(a + b*tan(e + f*x)^2)^p, x)